<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    用户名<input type="text" id='username' disabled  placeholder="请输入用户名"><br/>
    电话<input type="text" id='telephone' placeholder="请输入电话"><br/>
    密码<input type="text" id="password" placeholder="请输入密码"><br/>
    <button id='btn'>提交</button>
</body>
<script src="jquery-1.11.3.js"></script>
<script>
var search=location.search
var id=search.split('=')[1]

$.ajax({
    type:'get',
    url:`http://localhost/1907/xiugai.php?id=${id}`,
    dataType:'json',
    success:function(data){
        // console.log(data)
        if(data['code']==1){
            $('#username').val(data['data']['username'])
            $('#telephone').val(data['data']['telephone'])
            $('#password').val(data['data']['password'])
        }else{
            alert(data.msg)
        }

    }
})

$('#btn').on('click',function(){
 
    $.ajax({
        type:'get',
        url:`http://localhost/1907/updata.php?id=${id}&password=${$('#password').val()}&telephone=${$('#telephone').val()}`,
        dataType:'json',
        success:function(data){
            console.log(data)
            if(data['code']==1){
               alert(data.msg)
            }else{
                alert(data.msg)
            }
        }
    })




})



</script>
</html>